package com.cskaoyan.market.config;

import com.cskaoyan.market.db.domain.MarketSystem;
import com.cskaoyan.market.db.domain.MarketSystemExample;
import com.cskaoyan.market.db.mapper.MarketSystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;


@Component
public class SystemConfig {
    @Autowired
    MarketSystemMapper marketSystemMapper;
    @Bean
    public boolean isAutoCreateShareImage() {
        MarketSystemExample marketSystemExample = new MarketSystemExample();
        MarketSystemExample.Criteria criteria = marketSystemExample.createCriteria();
        criteria.andKeyNameEqualTo("market_wx_share");
        MarketSystem marketSystem = marketSystemMapper.selectOneByExample(marketSystemExample);
        String keyValue = marketSystem.getKeyValue();
        return Boolean.parseBoolean(keyValue);
    }
}

